package cn.anecansaitin.not_enough_harness.gen;

import cn.anecansaitin.not_enough_harness.NotEnoughHarness;
import cn.anecansaitin.not_enough_harness.common.harness_data.HarnessSpeed;
import cn.anecansaitin.not_enough_harness.common.harness_data.RushTriggerHarness;
import cn.anecansaitin.not_enough_harness.common.harness_data.SprintableHarness;
import cn.anecansaitin.not_enough_harness.common.ModDataMap;
import cn.anecansaitin.not_enough_harness.common.ModItems;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.PackOutput;
import net.minecraft.world.phys.Vec3;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.common.data.DataMapProvider;
import net.neoforged.neoforge.data.event.GatherDataEvent;

import java.util.concurrent.CompletableFuture;

@EventBusSubscriber(modid = NotEnoughHarness.MOD_ID)
public class DataMap extends DataMapProvider {
    protected DataMap(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> lookupProvider) {
        super(packOutput, lookupProvider);
    }

    @Override
    protected void gather(HolderLookup.Provider provider) {
        builder(ModDataMap.HARNESS_SPEED)
                .add(ModItems.VERTILEAP_HARNESS, new HarnessSpeed(0.2f, 0.2f, 0.2f, 0.2f, 0.5f, 0.15f), false)
                .add(ModItems.JET_HARNESS, new HarnessSpeed(0.5f, 0.2f, 0.2f, 0.2f, 0.15f, 0.15f), false)
                .add(ModItems.CLOUD_WALKER_HARNESS, new HarnessSpeed(0.3f, 0.25f), false)
                .add(ModItems.BOX_HARNESS, new HarnessSpeed(0.2f, 0.7f, 0.2f, 0.2f, 0.15f, 0.15f), false)
                .add(ModItems.RUSH_HARNESS, new HarnessSpeed(0.3f, 0.2f, 0.2f, 0.2f, 0.15f, 0.15f), false)
        ;

        builder(ModDataMap.SPRINTABLE_HARNESS)
                .add(ModItems.JET_HARNESS, new SprintableHarness(20 * 5, 20 * 5, 1f, -0.1f, -0.1f, -0.1f, 0, 0), false)
                .add(ModItems.BOX_HARNESS, new SprintableHarness(20 * 5, 20 * 5, -0.1f, 1f, -0.1f, -0.1f, 0, 0), false)
        ;

        builder(ModDataMap.RUSH_TRIGGER_HARNESS)
                .add(ModItems.RUSH_HARNESS, new RushTriggerHarness(20 * 5, 20 * 5, 2f, new Vec3(0, 0, 1)), false);
    }

    @SubscribeEvent
    public static void gatherData(GatherDataEvent.Client event) {
        event.createProvider(DataMap::new);
    }
}
